{% extends "base.html" %}
{% block title %}
    新闻管理
{% endblock %}
{% block head %}
    <link href="/static/lib/sb-admin/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="/static/lib/sb-admin/vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="/static/lib/sb-admin/dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="/static/lib/sb-admin/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
{% endblock %}
{% block label %}
    <h1 class="page-header">
        新闻管理<a class="btn btn-default pull-right" href="/oa_system/add_news/">添加</a>
    </h1>
{% endblock %}
{% block contenter %}
    <div class="row">
        <table class="table">
            <thead>
            <tr>
            <tr>
                <th>标题</th>
                <th>作者</th>
                <th>时间</th>
                <th>操作</th>
            </tr>
            </tr>
            </thead>
            <tbody>
            {% for news in news_list.items %}
                <tr>
                    <td class="col-lg-5">{{ news.title }}</td>
                    <td class="col-lg-2">{{ news.author }}</td>
                    <td class="col-lg-2">{{ news.publish_time }}</td>
                    <td class="col-lg-3">
                        <a class="btn btn-default" href="/oa_system/news/{{ news.id }}">详情</a>
                        <a class="btn btn-default" href="/oa_system/edit_news/{{ news.id }}">编辑</a>
                        <a class="btn btn-default" href="/oa_system/delete_news/{{ news.id }}/">删除</a>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
        <ul class="pagination pull-right">
            {% if news_list.has_prev %}
                <li><a href="/oa_system/news/?page=1">首页</a></li>
                <li><a href="/oa_system/news/?page={{ news_list.prev_num }}">上一页</a></li>
            {% endif %}
            {% for num in news_list.iter_pages(1,1,2,1) %}
                {% if num %}
                    {% if num == news_list.page %}
                        <li><a href="#">{{ num }}</a></li>
                    {% else %}
                        <li><a href="/oa_system/news/?page={{ num }}">{{ num }}</a></li>
                    {% endif %}
                {% else %}
                    <li><a href="#">...</a></li>
                {% endif %}
            {% endfor %}
            {% if news_list.has_next %}
                <li><a href="/oa_system/news/?page={{ news_list.next_num }}">下一页</a></li>
                <li><a href="/oa_system/news/?page={{ news_list.pages }}">尾页</a></li>
            {% endif %}
        </ul>
    </div>
{% endblock %}
{% block body %}
    <!-- /#wrapper -->

    <!-- jQuery -->
    <script src="/static/lib/sb-admin/vendor/jquery/jquery.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="/static/lib/sb-admin/vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="/static/lib/sb-admin/vendor/metisMenu/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="/static/lib/sb-admin/dist/js/sb-admin-2.js"></script>

{% endblock %}
